package com.xio.cloud.handler;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.xio.cloud.domain.CommonResult;
import com.xio.cloud.domain.Payment;

/**
 * @Author: xio
 * @Description: 自定义流控阻塞处理类
 * @Date: 2021/3/23 22:17
 */
public class CustomerBlockHandler {

    // 方法参数和返回类型需要跟 控制层接口一致 参数后面再加一个 BlockException
    public static CommonResult handleException(Long id, BlockException exception) {
        return new CommonResult<>(207, "按照自定义阻塞处理类返回");
    }

    public static CommonResult handleException2(BlockException exception) {
        return new CommonResult(208, "按照自定义阻塞处理类返回2");
    }

    // 返回类型需要跟接口返回类型一致 否则报错
    public static String handleStrException(BlockException exception) {
        return "CustomerBlockHandler - - - - 按照自定义阻塞处理类返回";
    }

}
